<template>
  <div>
    <el-dialog
      class="idadd"
      title="初始化的菜单列表"
      :visible.sync="dialogVisible"
      width="45%"
    >
      <el-alert title="请谨慎操作! 初始化菜单会覆盖之前记录!" type="warning">
      </el-alert>
      <div>
        <el-tree
          :data="data"
          node-key="id"
          :default-expanded-keys="[2, 3]"
          :default-checked-keys="[5]"
          :props="defaultProps"
        >
        </el-tree>
      </div>

      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="submit">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import authority from '@/api/authority'
import mixin from '@/mixins'
export default {
  mixins: [mixin],

  data() {
    return {
      searchFrom: {}, //输入框里的对象
      form: {}, //实际搜索要用的表单
      tableData: [], //文章列表数据
      dialogVisible: false,
      data: [],
      defaultProps: {
        children: 'children',
        label: 'title',
      },
    }
  },
  created() {},
  mounted() {},
  methods: {
    submit() {
      this.dialogVisible = false
    },
    //子组件的打开方法
    open() {
      this.dialogVisible = true
      authority.getInitMenusApi().then(res => {
        this.data = res.data.permissionList
        console.log(this.data, 'resssssss')
      })
    },

    searchs(row) {
      console.log(row, 'rowrowrow')
      this.$refs.SkuDetail.open(row)
    },
  },
}
</script>

<style scoped lang="scss">
.idadd ::v-deep .el-dialog {
  height: 500px !important;
}
</style>